////////////////////////////////////////////////////////////////////////////////
//                                                                            //
//  Filename:    EnchantedGardenGuts.h	     								  //
//  Developer:   Ryan Sauls												      //
//  Create date: 9/7/2006                                                     //
//                                                                            //
////////////////////////////////////////////////////////////////////////////////
//                                                                            //
//  Description: This is the class declaration for the slot gut of the        //
//               Australian Slot machine called Enchanted Garden.            //
//                                                                            //
////////////////////////////////////////////////////////////////////////////////
//        Copyright (c) 2006 - Realtime Gaming.  All rights reserved.         //
////////////////////////////////////////////////////////////////////////////////

#pragma once
#include "slotguts.h"
#include "getrand.h"

class EnchantedGardenGuts :
	public SlotGuts
{
	typedef SlotGuts super;

public:
	
	#pragma region Shared enums between client and server
		#include "EnchantedGardenCommon.h"
	#pragma endregion	

	#pragma region Private Enums

		enum
		{
			VALID_GUTS_RANGE_BEGIN	= 2300,
			VALID_GUTS_RANGE_END	= 2399
		};

	#pragma endregion
	
	#pragma region Construction & Destruction
	
	EnchantedGardenGuts(void);
	virtual ~EnchantedGardenGuts(void);
	
	#pragma endregion

	#pragma region Helpful lookup arrays.

		static SpinResult g_aLineWinSpinResults[NUM_VALID_ICONS][6];

		static SpinResult g_aScatterWinSpinResults[6];

		static ScatterMasks g_aScatterMasks[5];

	#pragma region Inline functions to use with the arrays that also do bounds checking.

		static SpinResult lookupLineWinSpinResult( uint8 nIconType, uint8 nCount )
		{
			if ( nIconType < NUM_VALID_ICONS && nCount < 6 )
			{
				return g_aLineWinSpinResults[ nIconType ][ nCount ];
			}

			ASSERT( false );
			return EVT_INVALID;
		}

		static SpinResult lookupScatterWinSpinResult( uint8 nCount )
		{
			if ( nCount < 6 )
			{
				return g_aScatterWinSpinResults[ nCount ];
			}

			ASSERT( false );
			return EVT_INVALID;
		}

	#pragma endregion

	#pragma endregion

protected:

	#pragma region Methods

		SpinResult		getLineWinResult( uint8* stops, uint8 testIcon, 
											bool& bSubstitution /*out value*/ );

		void			tryForJackpot(SlotSpin* spin);
		void			evaluateScatterWin(SlotSpin* spin, SpinResult srScatterResult, int32 scatterPositions);
		void			evaluateFeatureTrigger(SlotSpin* spin, SpinResult srScatterResult, int32 scatterPositions, uint8 numScatterIcons);
		SpinResult		getScatterWinResult(SlotSpin* spin, int32& scatterPositions, uint8& numScatterIcons) const;
		
		int32			getFireflyIconsOnSpin( SlotSpin* spin, int32& fireflyPositions );
		bool8			isFreeModeFireflyIcon( uint8 icon )			const;

	#pragma endregion

	#pragma region Overridden Virtual Methods
		virtual bool8	isValidGuts();	
		virtual void	preSpinClassifyResults( SlotSpin* spin );
		virtual void	classifyStops( SpinLine* spinline, uint8* stops, uint8 bet, uint8 line, uint8& rtnresult, uint8& multiplier );
		virtual void	classifyScatters( SlotSpin *spin );
		virtual void	Debug_SetLoserStops( uint8* pStops );		
		virtual void	getGameModeMultiplierAndNoteId( uint8& nGameModeMultiplier, uint8& nNoteId );
	#pragma endregion
};
